window.onload = function() {
	var div = document.getElementById("div");

	//透明度变小
	div.onmouseover = function() {
			changeTransp(0);
			alpha = 100;
		}
		// 透明度变大
	div.onmouseout = function() {
		alpha = 0;
		changeTransp(100);
	}
}
var alpha;

function changeTransp(iTarget) {
	var timer = null;

	var div = document.getElementById("div");
	clearInterval(timer);
	timer = setInterval(
		function() {
			var speed = 0;
			if (alpha < iTarget) {

				speed = 10;
			} else {

				speed = -10;
			}
			if (alpha == iTarget) {
				clearInterval(timer);
			} else {
				alpha += speed;
				div.style.filte = "alpha(opacity:" + alpha + ")"; //ie
				div.style.opacity = alpha / 100;
			}
		}, 30);
}